#!/bin/bash

dirnam=`dirname $0`
gapdir=`dirname $dirnam`

# 32 bit version
cd $gapdir
source sysinfo.gap-default32
cat $gapdir/extern/gmp-5.0.5/../../bin/i686-pc-linux-gnu-gcc-default32/extern/gmp/lib/libgmp.la |sed -e "s|/users/luebeck/build45/gap4r5|$gapdir|" > $gapdir/extern/gmp-5.0.5/../../bin/i686-pc-linux-gnu-gcc-default32/extern/gmp/lib/libgmp.la.1
mv $gapdir/extern/gmp-5.0.5/../../bin/i686-pc-linux-gnu-gcc-default32/extern/gmp/lib/libgmp.la.1 $gapdir/extern/gmp-5.0.5/../../bin/i686-pc-linux-gnu-gcc-default32/extern/gmp/lib/libgmp.la
libdir=$gapdir/bin/$GAParch/extern_libs/:$gapdir/bin/$GAParch/extern/gmp/lib/:
cd pkg/float*/bin/$GAParch
$dirnam/patchelf --set-rpath $libdir float.so

# 64 bit version
cd $gapdir
source sysinfo.gap-default64
cat $gapdir/extern/gmp-5.0.5/../../bin/x86_64-unknown-linux-gnu-gcc-default64/extern/gmp/lib/libgmp.la |sed -e "s|/users/luebeck/build45/gap4r5|$gapdir|" > $gapdir/extern/gmp-5.0.5/../../bin/x86_64-unknown-linux-gnu-gcc-default64/extern/gmp/lib/libgmp.la.1
mv $gapdir/extern/gmp-5.0.5/../../bin/x86_64-unknown-linux-gnu-gcc-default64/extern/gmp/lib/libgmp.la.1 $gapdir/extern/gmp-5.0.5/../../bin/x86_64-unknown-linux-gnu-gcc-default64/extern/gmp/lib/libgmp.la
libdir=$gapdir/bin/$GAParch/extern_libs/:$gapdir/bin/$GAParch/extern/gmp/lib/:
cd pkg/float*/bin/$GAParch
$dirnam/patchelf --set-rpath $libdir float.so

rm -f `dirname $0`/callpostsync

